<?php
header('content-type:text/html;charset=utf-8');
$subject="
    京东 http://www.jd.com
  天猫 https://tmall.com
 一号店 http://yhd.com
   麦子学院 http://maiziedu.com
   King的博客 http://phpfamily.org
";
$pattern="#[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?#ie";
$subject=preg_replace($pattern, 'strtoupper("$0")', $subject);
echo $subject;